package vn.com.tiz.core.task;

import android.content.Context;
import android.os.AsyncTask;

public abstract class AbstractCallbackableTask<Params, Progress, Result> extends AsyncTask<Params, Progress, Result> {

	protected final String TAG = getClass().getSimpleName();

	protected TaskResultCallback<Result> callback;
	protected Context context;

	public AbstractCallbackableTask(Context context) {
		this.context = context.getApplicationContext();
	}

	@Override
	protected void onPostExecute(Result result) {
		if (null != this.callback) {
			this.callback.onCallback(result);
		}
	};

	/**
	 * 
	 * @param callback
	 */
	public void setCallback(TaskResultCallback<Result> callback) {
		this.callback = callback;
	};
}
